package com.dm.wallpaper.library.abilityPackage;


import com.dm.wallpaper.library.utils.Log;
import com.dm.wallpaper.library.utils.JsonStructure;

/**
 * Author: Dani Mahardhika
 * Created on: 10/27/2017
 * https://github.com/danimahardhika
 */

public class WallpaperBoardConfiguration {

    private
    NavigationIcon mNavigationIcon = NavigationIcon.DEFAULT;
    private
    NavigationViewHeader mNavigationViewHeader = NavigationViewHeader.NORMAL;
    private
    GridStyle mWallpapersGrid = GridStyle.CARD;

    private boolean mIsHighQualityPreviewEnabled = false;
    private boolean mIsCropWallpaperEnabledByDefault = false;
    private boolean mIsDashboardThemingEnabled = true;
    private boolean mIsShadowEnabled = true;
    private int mLatestWallpapersDisplayMax = 15;

    private int mAppLogoColor = -1;

    private boolean mIsCrashReportEnabled = true;
    private String mCrashReportEmail = null;

    private JsonStructure mJsonStructure = new JsonStructure.Builder().build();

    public WallpaperBoardConfiguration setNavigationIcon(NavigationIcon navigationIcon) {
        mNavigationIcon = navigationIcon;
        return this;
    }

    public WallpaperBoardConfiguration setAppLogoColor(int color) {
        mAppLogoColor = color;
        return this;
    }

    public WallpaperBoardConfiguration setNavigationViewHeaderStyle(NavigationViewHeader navigationViewHeader) {
        mNavigationViewHeader = navigationViewHeader;
        return this;
    }

    public WallpaperBoardConfiguration setWallpapersGridStyle(GridStyle gridStyle) {
        mWallpapersGrid = gridStyle;
        return this;
    }

    public WallpaperBoardConfiguration setDashboardThemingEnabled(boolean dashboardThemingEnabled) {
        mIsDashboardThemingEnabled = dashboardThemingEnabled;
        return this;
    }

    public WallpaperBoardConfiguration setShadowEnabled(boolean shadowEnabled) {
        mIsShadowEnabled = shadowEnabled;
        return this;
    }

    //@IntRange(from = 5, to = 15)
    public WallpaperBoardConfiguration setLatestWallpapersDisplayMax(int count) {
        if (count < 5 || count > 15) {
            Log.e("WallpaperBoardConfiguration.setLatestWallpapersDisplayMax([count]):68        数值超出范围 ");
            return this;
        }
        int finalCount = count;
        if (finalCount < 5) {
            finalCount = 5;
        } else if (finalCount > 15) {
            finalCount = 15;
        }
        mLatestWallpapersDisplayMax = finalCount;
        return this;
    }

    public WallpaperBoardConfiguration setHighQualityPreviewEnabled(boolean highQualityPreviewEnabled) {
        mIsHighQualityPreviewEnabled = highQualityPreviewEnabled;
        return this;
    }

    public WallpaperBoardConfiguration setCropWallpaperEnabledByDefault(boolean enabled) {
        mIsCropWallpaperEnabledByDefault = enabled;
        return this;
    }

    public WallpaperBoardConfiguration setCrashReportEnabled(boolean crashReportEnabled) {
        mIsCrashReportEnabled = crashReportEnabled;
        return this;
    }

    public WallpaperBoardConfiguration setCrashReportEmail(String email) {
        mCrashReportEmail = email;
        return this;
    }

    public WallpaperBoardConfiguration setJsonStructure(JsonStructure jsonStructure) {
        mJsonStructure = jsonStructure;
        return this;
    }

    public NavigationIcon getNavigationIcon() {
        return mNavigationIcon;
    }

    public int getAppLogoColor() {
        return mAppLogoColor;
    }

    public NavigationViewHeader getNavigationViewHeader() {
        return mNavigationViewHeader;
    }

    public GridStyle getWallpapersGrid() {
        return mWallpapersGrid;
    }

    public boolean isDashboardThemingEnabled() {
        return mIsDashboardThemingEnabled;
    }

    public boolean isShadowEnabled() {
        return mIsShadowEnabled;
    }

    public int getLatestWallpapersDisplayMax() {
        return mLatestWallpapersDisplayMax;
    }

    public boolean isHighQualityPreviewEnabled() {
        return mIsHighQualityPreviewEnabled;
    }

    public boolean isCropWallpaperEnabledByDefault() {
        return mIsCropWallpaperEnabledByDefault;
    }

    public boolean isCrashReportEnabled() {
        return mIsCrashReportEnabled;
    }

    public String getCrashReportEmail() {
        return mCrashReportEmail;
    }

    public JsonStructure getJsonStructure() {
        return mJsonStructure;
    }

    public enum NavigationIcon {
        DEFAULT,
        STYLE_1,
        STYLE_2,
        STYLE_3,
        STYLE_4,
    }

    public enum NavigationViewHeader {
        NORMAL, MINI, NONE
    }

    public enum GridStyle {
        CARD,
        FLAT
    }
}
